package com.learn.spring.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class TransactionDao implements ITransactionDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void inMoney(int id, int money) {
        jdbcTemplate.update("update t_user set age= age + ? where id = ?", money, id);
    }

    @Override
    public void outMoney(int id, int money) {
        jdbcTemplate.update("update t_user set age= age - ? where id = ?", money, id);
    }
}
